package upicgame.entity;

import javax.persistence.*;

/*
 *Created by GHW
 *Description:用户评论
 *2019/12/26 17:54
 */
@Entity
@Table(name = "comments")
public class Comments {
    private Integer id;
    private String Comments;    //评论内容
    private String currentCommentDate; //评论时的日期和时间  原格式Fri Dec 27 23:06:59 CST 2019 Date强转为String 格式为 yyyy-MM-dd HH:mm:ss
    private User user;      //评论 -- 多对一 -- 用户
    private Game game; //评论 -- 多对一 -- 游戏

    public Comments() {
    }

    public Comments(Integer id, String Comments, User user, Game game) {
        this.id = id;
        this.Comments = Comments;
        this.user = user;
        this.game = game;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "comments")
    public String getComments() {
        return Comments;
    }

    public void setComments(String comments) {
        Comments = comments;
    }

    @Column(name = "comment_date")
    public String getCurrentCommentDate() {
        return currentCommentDate;
    }

    public void setCurrentCommentDate(String currentCommentDate) {
        this.currentCommentDate = currentCommentDate;
    }

    @ManyToOne
    @JoinColumn(name = "user_id")
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @ManyToOne
    @JoinColumn(name = "game_id")
    public Game getGame() {
        return game;
    }

    public void setGame(Game game) {
        this.game = game;
    }

    @Override
    public String toString() {
        return "Comments{" +
                "id=" + id +
                ", Comments='" + Comments + '\'' +
                ", currentCommentDate='" + currentCommentDate + '\'' +
                ", user=" + user +
                ", game=" + game +
                '}';
    }
}
